<!--
  - Copyright (c) 2019.  武汉中科图灵科技有限公司
  - Date :  2019/1/5
  - Author ：F12 Console=> atob("MzMxNDkxODAwQHFxLmNvbQ==")
  - Version ：1.6.2
  -->

<template>
	<div>
	<el-form ref="tenetForm" :model="tenetForm" label-width="80px" label-position="top">
		  <el-form-item label="平面图设置">
		    <el-radio-group v-model="tenetForm.planSetup">
		      <el-radio :label="'1'">启用</el-radio>
		      <el-radio :label="'0'">不启用</el-radio>
		    </el-radio-group>
		  </el-form-item>
	</el-form>
	<el-button type="primary" size="mini" @click="saveConfig">保存</el-button>
	</div>
</template>
<script>
import {
  setImgAuth,
  getImgAuth
} from "@/api/device/tenetConfig/index";
	export default{
		data(){
			return{
				tenetForm:{
					planSetup:'0'
				}
			}
		},
		mounted(){
			this.$store.dispatch("getImgAuth").then(()=>{
				this.tenetForm.planSetup=this.$store.getters.planSetup;
			})
		},
		methods:{
			saveConfig(){
				setImgAuth(this.tenetForm).then(res=>{
					if (res.status==200) {
						this.$notify({
				            title: "成功",
				            message: "保存成功！",
				            type: "success",
				            duration: 2000
				          });
					}else{
						this.$notify({
				            title: "提示",
				            message:res,message ,
				            type: "warning",
				            duration: 2000
				          });
					}
				}).catch(()=>{
					this.$notify({
			            title: "提示",
			            message:"网络错误！",
			            type: "warning",
			            duration: 2000
			          });
				})
			}
		}
	}
</script>
